<template>
  <div class="app-container">
    <!-- 查询 -->
    <tl-list-search ref="search" :query-param="queryParam" @search="doQuery" :isDisplayDefaultSearch="false">
      <template slot="search">
        <el-form-item label="页面名称">
          <el-input v-model="queryParam.qry_name" placeholder></el-input>
        </el-form-item>
        <el-form-item label="页面编码">
          <el-input v-model="queryParam.qry_code" placeholder></el-input>
        </el-form-item>
      </template>
    </tl-list-search>
    <!-- 工具栏 -->
    <tl-list-toolbar ref="toolbar" @refresh="doRefresh" @columnCustomize="doColumnCustomize" :isDisplayAdd="true" :isDisplayDeleteBatch="false" :isDisplayExport="false" @add="openAddDialog('editForm')"></tl-list-toolbar>
    <div>
      <!-- 列表选择 -->
      <div class="table-alert-div" ref="selector">
        <el-alert type="success" :closable="false" class="tl-table-alert-info" effect="light">
          <template slot="title">
            已选择&nbsp;
            <a class="tl-table-alert-info-a1">{{ selectedRowKeys.length }}</a
            >项&nbsp;&nbsp;
            <a class="tl-table-alert-info-a2" @click="doClearSelected">全部清空</a>
          </template>
        </el-alert>
      </div>
      <!--表格渲染-->
      <el-table class="tl-table" ref="mainTable" style="width:100%" :height="tableHeight" resizable-key="tableHeight" :resizable-refs="tableResizeRefs" v-loading="loading" :data="datas" @selection-change="doSelectChange" @sort-change="doSortChange" row-key="id" border fit :row-class-name="doChangeRowClassName">
        <el-table-column type="selection" width="55"> </el-table-column>
        <el-table-column type="index" label="序号" width="55px" header-align="center" align="center"> </el-table-column>
        <el-table-column prop="name" label="页面名称" min-width="16.5%" sortable="custom" sort-by="name" align="center"></el-table-column>
        <el-table-column prop="code" label="页面编码" min-width="13.5%" sortable="custom" sort-by="code" align="center"></el-table-column>
        <el-table-column prop="extendfield1" label="扩展1" min-width="6.5%" sortable="custom" sort-by="extendfield1" align="center"></el-table-column>
        <el-table-column prop="extendfield2" label="扩展2" min-width="6.5%" sortable="custom" sort-by="extendfield2" align="center"></el-table-column>
        <el-table-column prop="extendfield3" label="扩展3" min-width="6.5%" sortable="custom" sort-by="extendfield3" align="center"></el-table-column>
        <el-table-column prop="sortcode" label="排序码" min-width="6.5%" sortable="custom" sort-by="sortcode" align="center"></el-table-column>
        <el-table-column prop="dispenabled" label="有效" min-width="6.5%" sortable="custom" sort-by="enabled" align="center"></el-table-column>
        <el-table-column prop="description" label="备注" min-width="9.5%" sortable="custom" sort-by="description" align="center"></el-table-column>
        <el-table-column label="操作" width="320px" align="center" fixed="right">
          <template slot-scope="scope">
            <el-button type="text" icon="el-icon-edit" @click="openEditDialog('editForm', scope.row.id)">编辑</el-button>
            <el-button type="text" icon="el-icon-delete" @click="doDelete(scope.row.id)">删除</el-button>
            <el-button type="text" icon="el-icon-view" @click="openViewDialog('editForm', scope.row.id)">查看</el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 列表分页 -->
      <el-row class="pagebar" ref="pager">
        <el-pagination @size-change="doChangeSize" @current-change="doChangeIndex" :current-page="pageInfo.currentPage" :page-sizes="pageInfo.pageSizes" :total="pageInfo.totalCount" layout="total, sizes, prev, pager, next, jumper" background class="tl-table-pagination"></el-pagination>
      </el-row>
    </div>
    <tl-edit ref="editForm" @refresh="doRefresh" :enabledList="enabledList"></tl-edit>
  </div>
</template>

<script>
// import checkPermission from '@/utils/permission' // 权限判断函数
/** mixins */
import { mixin_list } from "@tapui/mixins/mixin_list"
/** 子组件 */
import tlEdit from "./edit"
import { getAction, putAction, postAction } from "@tapui/utils/http"
export default {
  name: "pageMgt",
  components: { tlEdit },
  mixins: [mixin_list],
  data() {
    return {
      description: "APP审批页面管理列表",
      urlPrefix: '/app/appPage/',
      url: {
        queryDataCodeList: "/app/appPage/dataCodeList"
      },
      enabledList: []
    }
  },
  methods: {
    queryDataCodeList(parameter) {
      getAction(this.url.queryDataCodeList, parameter).then((res) => {
        if (res.success) {
          this.enabledList = res.result.enabledList
        } else {
          this.$tap.alert(res.message)
        }
      })
    }
  },
  mounted() {
    this.queryDataCodeList({})
  }
}
</script>
